<?php
/**
 * 牌号
 * @author yu
 * @created 2017-2-14 14:03:42
 */
namespace brand\service;

use herosphp\core\Log;
use api\utils\SaasApiClient;

class BrandService
{


    /**
     * 获取牌号数据
     * @param $data
     * @return array|\herosphp\utils\the
     */
    public function getItems($pagesize, $page, $order,$search_arr)
    {
        $url = "api/brand/getBrandsByMemberId";

        $result = SaasApiClient::send($url, array('pagesize' => "$pagesize", 'page' => "$page",'order'=>$order, 'search_arr' => $search_arr));
        if ($result->isSucess()) {

            $items = $result->getData();


        } else {
            Log::info($result->getMessage());
            $items = array();
        }

        return $items;

    }

    /**
     * 添加牌号数据
     * @param $data
     */
    public function add($data)
    {

        $url = "api/brand/addBrand";

        $result = SaasApiClient::send($url, $data);

        if ($result->isSucess()) {

            return $result;

        } else {
            Log::info($result->getMessage());
            return array();
        }
    }

}